# Maintainer: Jan Alexander Steffens (heftig) <heftig@archlinux.org>
# Contributor: Jan de Groot <jgc@archlinux.org>

pkgbase=atkmm
pkgname=(atkmm atkmm-docs)
pkgver=2.28.2
pkgrel=2
pkgdesc="C++ bindings for ATK"
url="https://www.gtkmm.org/"
arch=(x86_64)
license=(LGPL)
depends=(atk glibmm)
makedepends=(git meson mm-common glibmm-docs)
options=(!emptydirs)
_commit=9d32ab6180abaee57f6dd8fc9ea094563e802bb7  # tags/2.28.2^0
source=("git+https://gitlab.gnome.org/GNOME/atkmm.git#commit=$_commit")
sha256sums=('SKIP')

pkgver() {
  cd atkmm
  git describe --tags | sed 's/-/+/g'
}

prepare() {
  cd atkmm
}

build() {
  arch-meson atkmm build -D maintainer-mode=true
  meson compile -C build
}

check() {
  meson test -C build --print-errorlogs
}

package_atkmm() {
  depends+=(libsigc-2.0.so libglibmm-2.4.so)
  provides=(libatkmm-1.6.so)

  meson install -C build --destdir "$pkgdir"

  # Split -docs
  mkdir -p docs/usr/share
  mv -t docs/usr/share "$pkgdir"/usr/share/{devhelp,doc}
}

package_atkmm-docs() {
  pkgdesc+=" (documentation)"
  depends=()
  options=(!strip)

  mv -t "$pkgdir" docs/*
}
